<?php
header("Content-type:text/html;charset:utf-8");
require 'config_db.php'; //顺序不能乱
require 'db_connect_fn.php';
if(empty($_POST)){//如果发送过来的数据是空的，加载模板重新添加
      include './tpl/add.html';
}else{//有直接发送sql，返回添加结果，跳转到显示页（index.php）
      sql_exe("INSERT INTO class (cname) values('{$_POST['cname']}')");
      echo "添加班级成功";
      echo "<script>setTimeout(function(){location.href='index.php'},2000)</script>";
}






?>
